﻿using System.Windows;
using System.Windows.Interactivity;
using nRoute.Components;

namespace Orktane.Behaviors
{
    public class UpdateValueRelayAction 
        : TriggerAction<UIElement>
    {
        public static readonly DependencyProperty ValueRelayProperty =
            DependencyProperty.Register("ValueRelay", typeof(ValueRelay), typeof(UpdateValueRelayAction),
            new PropertyMetadata(null));

#region Properties

        public ValueRelay ValueRelay
        {
            get { return (ValueRelay)GetValue(ValueRelayProperty); }
            set { SetValue(ValueRelayProperty, value); }
        }

#endregion

#region Overrides

        protected override void Invoke(object parameter)
        {
            if (ValueRelay != null) ValueRelay.Value = parameter;
        }

#endregion

    }
}
